Add differential property tests - #47
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #47 +/- ##
==========================================
+ Coverage 87.75% 90.46% +2.70%
==========================================
Files 6 7 +1
Lines 294 409 +115
==========================================
+ Hits 258 370 +112
- Misses 36 39 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
eserilev
commented
Jul 23, 2026
Comment on lines
+133
to
134
| /// has a depth of 1, and a tree with 4 leaves has a depth of 3. | ||
| depth: usize, |
Member
Author
There was a problem hiding this comment.
We could change this to be depth = 0 at the root node instead of depth = 1 OR we could change this field name to num_layers
Or we can just keep as is, with an updated comment. I dont have a super strong opinion either way, though I think changing the value of depth might technically be a sketchier change
Member
There was a problem hiding this comment.
I think we can come back for some cleanup here, I've opened an issue:
michaelsproul
approved these changes
Jul 27, 2026
michaelsproul
left a comment
Member
There was a problem hiding this comment.
Looks good, great catch!
eserilev
added a commit
to eserilev/tree_hash
that referenced
this pull request
Jul 28, 2026
Extend the differential property tests (sigp#47) and derive macro tests (sigp#48) to cover the new functionality in the progressive branch: - Property test ProgressiveMerkleHasher against a recursive reference implementation of EIP-7916 merkleize_progressive, with random byte lengths and random write splits to exercise the partial-chunk carry buffer, up to 128 chunks to cross all early level boundaries. - Property test ProgressiveBitList hashing against the same reference with independent bit packing, covering the empty-list workaround. - Derive tests for progressive containers: skip_hashing interaction, nesting (both directions), generics, tree_hash_type, a six-field container crossing a progressive level boundary, and active_fields spanning multiple bytes. - Hard-coded roots for the level-crossing and multi-byte cases computed independently from the EIP pseudocode, so these tests do not rely on the hasher under test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PpXigbebk4GAQ9D9qdFzU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add differential property testing in CI to test agreement across our three merkelize implementations. Previously we were only testing a handful of cases. Now we are testing against 300k randomly generated inputs.
Also two minor bugfixes:
random_byteswas usingVec::with_capacity(bytes)which creates a zero length vec. Sofill_bytesfilled nothing, all existing random test were testing empty input.PR written by Claude, but self reviewed by me